package com.controller;

import com.entity.Course;
import com.entity.CourseType;
import com.service.MenuService;
import com.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

@RestController
public class MenuController {


    @Autowired
    MenuService menuService;
//
    @RequestMapping("/ct/findCourseType.do")
    public Map findCourseType(){
//        List<CourseType> courseTypes =menuService.selCourseType();
//        List<Course> courses = menuService.selCourseAndType();
//        HashMap hashMap = new HashMap();
//        hashMap.put("courseTypes",courseTypes);
//        hashMap.put("courses",courses);
//        System.out.println(courseTypes+"=================");
        List<CourseType> courseTypes = menuService.selCourseType();
        List<CourseType> courseTypes1 = menuService.selCourseType2();
        List<CourseType> courseTypes2 = menuService.selCourseType3();
        HashMap hashMap = new HashMap();
        hashMap.put("courseType1",courseTypes);
        hashMap.put("courseType2",courseTypes1);
        hashMap.put("courseType3",courseTypes2);
        return hashMap;
    }

    @RequestMapping("/course/showTop15.do")
    public List<Course> showTop15(){
        List<Course> courses = menuService.selCourse();
        System.out.println(courses+"-------------");
        return courses;
    }
}
